import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { GTextFormat } from "../../../common/GTextFormat";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { SArenaCrossToplist } from "../../../../Message/Public/SArenaCrossToplist";
import { GameDefConfig } from "../../resource/GameDefConfig";
import { CareerConfig } from "../../resource/CareerConfig";
import { ColorConfig } from "../../resource/ColorConfig";
import { Language } from "../../../../extend/language/Language";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { EVIPType } from "../../../../Message/Public/EVIPType";
//class ArenaCorssToplistRenderer
    
    export  class ArenaCorssToplistRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            super.configUI();
            this._tf = new GTextFormat("", 12, 11661311, null, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._rankTxt = ObjCreate.createTextField("", 10, 10, 50, 20, this, this._tf);
            this._nameTxt = ObjCreate.createTextField("", 100, 10, 110, 20, this, this._tf);
            this._warfareTxt = ObjCreate.createTextField("", 230, 10, 110, 20, this, this._tf);
            this._sexTxt = ObjCreate.createTextField("", 330, 10, 90, 20, this, this._tf);
            this._careerTxt = ObjCreate.createTextField("", 400, 10, 80, 20, this, this._tf);
            this._campTxt = ObjCreate.createTextField("", 480, 10, 90, 20, this, this._tf);
            this._guildTxt = ObjCreate.createTextField("", 560, 10, 130, 20, this, this._tf);
            this._matchTxt = ObjCreate.createTextField("", 665, 10, 120, 20, this, this._tf);
            ObjCreate.createBg(5, 40, 780, 2, this, ImagesConst.SplitLine);
            this._adoreImg = new Object /* flash.display.Bitmap */();
            this._adoreImg.x = 10;
            this._adoreImg.y = 10;
            addChild(this._adoreImg);
            this._vipBitmap = new Object /* flash.display.Bitmap */();
            this._vipBitmap.x = 80;
            this._vipBitmap.y = 10;
            addChild(this._vipBitmap);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=0;
            var loc2=null;
            var loc3=0;
            var loc4=0;
            var loc5=null;
            var loc6=0;
            super.data = arg1;
            this._sArenaCrossToplis = arg1 as SArenaCrossToplist;
            if (this._sArenaCrossToplis) 
            {
                this._rankTxt.text = this._sArenaCrossToplis.rank + "";
                this._nameTxt.text = this._sArenaCrossToplis.miniPlayer.name;
                this._warfareTxt.htmlText = "<font color=\'#f0ea3f\'>" + this._sArenaCrossToplis.miniPlayer.warfare + "</font>";
                this._sexTxt.text = GameDefConfig.instance.getSex(this._sArenaCrossToplis.miniPlayer.sex).name;
                loc1 = this._sArenaCrossToplis.miniPlayer.career;
                loc2 = CareerConfig.instance.getInfoByCode(loc1).name;
                this._careerTxt.text = loc2;
                loc3 = this._sArenaCrossToplis.miniPlayer.camp;
                loc4 = ColorConfig.instance.getCountryColor(loc3).intColor;
                loc5 = new GTextFormat("", 12, loc4, false, false, false, null, null, flash.text.TextFormatAlign.CENTER);
                this._campTxt.text = GameDefConfig.instance.getECamp(loc3);
                this._campTxt.setTextFormat(loc5);
                if (this._sArenaCrossToplis.guildName && !(this._sArenaCrossToplis.guildName == "")) 
                {
                    this._guildTxt.text = this._sArenaCrossToplis.guildName + "";
                }
                else 
                {
                    this._guildTxt.text = "- -";
                }
                this._matchTxt.text = Language.getString(36188);
                if (this._sArenaCrossToplis.rank <= 3) 
                {
                    this._adoreImg.bitmapData = GlobalClass.getBitmapData(ImagesConst.RangeAdore);
                }
                else 
                {
                    this._adoreImg.bitmapData = null;
                }
                if ((loc6 = this._sArenaCrossToplis.miniPlayer.VIP) != EVIPType._EVIPTypeWeek) 
                {
                    if (loc6 != EVIPType._EVIPTypeMonth) 
                    {
                        if (loc6 != EVIPType._EVIPTypeHalfYear) 
                        {
                            this._vipBitmap.bitmapData = null;
                        }
                        else 
                        {
                            this._vipBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.TVip3);
                        }
                    }
                    else 
                    {
                        this._vipBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.TVip2);
                    }
                }
                else 
                {
                    this._vipBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.TVip1);
                }
            }
            else 
            {
                this._rankTxt.text = "";
                this._nameTxt.text = "";
                this._warfareTxt.text = "";
                this._sexTxt.text = "";
                this._careerTxt.text = "";
                this._campTxt.text = "";
                this._guildTxt.text = "";
                this._matchTxt.text = "";
                this._adoreImg.bitmapData = null;
                this._vipBitmap.bitmapData = null;
            }
            return;
        }

        /* internal */ /* var */_rankTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_nameTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_warfareTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_sexTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_careerTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_campTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_guildTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_matchTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_adoreImg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_vipBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_tf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_sArenaCrossToplis: SArenaCrossToplist;
    }
